package pairs;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class reducer extends Reducer<TextPair, DoubleWritable, TextPair, DoubleWritable> {
    @Override
    public void reduce(TextPair inputKey, Iterable<DoubleWritable> inputValues, Context context)
            throws IOException, InterruptedException {
        int sum = 0;
        for(DoubleWritable inC : inputValues) {
            sum += inC.get();
        }
        context.write(inputKey, new DoubleWritable(sum));
    }
}
